from rest_framework import serializers
from cart.models import CartModel
class CartService(serializers.ModelSerializer):
    cakelist = serializers.SerializerMethodField(read_only=True)
    def get_cakelist(self, obj):
        return [{"title": obj.cake.title, "price": obj.cake.price,"weight": obj.cake.weight,"cover": str(obj.cake.cover),"tro": obj.cake.tro}]
    class Meta:
        model = CartModel
        fields = "__all__"